<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href='__STATIC__/home/js/bootstrap/css/bootstrap.css' media='screen' rel='stylesheet' type='text/css'/>
    <link href='__STATIC__/home/details/css/detailsIndex.css' media='screen' rel='stylesheet' type='text/css'/>
    <link rel="shortcut icon" href="__STATIC__/home/index/picture/2.png" type="image/x-icon">
    <link href='__STATIC__/home/details/css/base-160225.min.css' media='screen' rel='stylesheet' type='text/css'/>
    <link href='__STATIC__/home/details/css/iconfont_5.css' media='screen' rel='stylesheet' type='text/css'/>
    <link href='__STATIC__/home/details/css/iconfont-1.css' media='screen' rel='stylesheet' type='text/css'/>
    <link href='__STATIC__/home/details/css/main.css' media='screen' rel='stylesheet' type='text/css'/>
    <link rel="stylesheet" href="__STATIC__/home/js/layer/theme/default/layer.css">


    <script src='__STATIC__/home/js/jquery.min.js' type='text/javascript'></script>
    <script src='__STATIC__/home/details/js/jssdk-0.0.18.min.js' type='text/javascript'></script>
    <script src='__STATIC__/home/details/js/lazyload.min.js' type='text/javascript'></script>
    <script src="__STATIC__/home/js/layer/layer.js"></script>
</head>
<body>
<div class="index-top" style="width: 90%;margin: auto;border: 1px solid rgba(178,179,168,0.67)">

    <div class="container" id="div">
        <div id="divVideo"></div>
    </div>
    <p>
        <button type="button" class="btn3 btn btn-success" data-id="{$details.courses_id}">通过</button>
        <button type="button" class="btn2 btn btn-warning" data-id="{$details.courses_id}">退回</button>
    </p>
</div>
</body>
<script>
    var clientWidth = document.getElementById("div").style.width;
    playVideo({
        //所有参数，elemt和src为必填其他看需求怎么要求
        //elemt为播放控件要插入的容器，
        // src为视频文件地址，
        // preload为预加载，
        // autoplay是否页面进入就自动播放
        //poster为播放前的遮照图片，
        // loop为是否循环播放，
        // width和heigth默认100%
        elemt: document.getElementById("divVideo"),
        src: "{$details.courses_content}",    //此地址是在本机测试用的，如果发布在服务器上请写服务器的绝对路径。我是发布在外网上的，例如：http://www.tttt.com/test/3.mp4
        preload: "true",
        autoplay: "false",
        poster: "{$details.courses_photo}",
        loop: "false",
        width: clientWidth,
        heigth: ""
    });

    function playVideo(opt) {
        if (typeof (opt) == "undefined") {
            alert("请传入必要参数！");
            return;
        }
        if (typeof (opt.elemt) == "undefined") {
            alert("请指定播放器要插入的对象！");
            return;
        }
        if (typeof (opt.src) == "undefined") {
            alert("请指定要播放视频的路径！");
            return;
        }
        var _this = this;
        _this.elemt = opt.elemt;                                       //播放器要插入的对象
        _this.src = opt.src;                                           //视频的URL(必设)
        _this.width = opt.width > 0 ? opt.width + "px" : "100%";       //宽度(默认100%)
        _this.height = opt.height > 0 ? opt.height + "px" : "100%";    //高度(默认100%)
        _this.autoplay = opt.autoplay == "true" ? "autoplay" : "";     //自动播放（true为自动播放）
        _this.poster = opt.poster;                                     //视频封面，播放时的封面图片
        _this.preload = opt.preload == "true" ? "preload" : "";        //预加载(true时启动加载)
        _this.loop = opt.loop == "true" ? "loop" : "";                 //循环播放(true时循环播放)
        var str = "<video id='video' controls ";                   //根据设置的属性的值，拼写video控件
        str += " width='" + _this.width + "' height='" + _this.height + "' " + _this.autoplay + " " + _this.preload + " " + _this.loop + " ";
        if (typeof (_this.poster) != "undefined") {
            str += " poster='" + _this.poster + "' >";
        } else {
            str += " > ";
        }
        str += " <source src='" + _this.src + "'  type='video/mp4; codecs='avc1.42E01E, mp4a.40.2''/>";
        str += "</video>";
        _this.elemt.innerHTML = str; //将str放到要插入的对象中
    }

    $(document).ready(function(){
        $(".btn2").click(function (){
            var link = $(this);
            var id = link.attr("data-id");
            var cid = link.attr("data-cid");
            if(cid == 2){
                layer.msg('文件已经退回，请不要重复操作');
                return false;
            }
            $.get("{:url('admin/examine/isEae')}?id="+id+"&code=1",function(data){
                console.log(data)
                if(data == 1){
                    layer.msg('退回成功');
                    setTimeout(function(){window.location.href=("admin/examine/videolist");},3000);
                }else{
                    layer.msg('退回失败,请检查文件内容');
                    setTimeout(function(){window.location.reload();},3000);
                }
            });
        });
    });

    <!--文件通过 -->
    $(document).ready(function(){
        $(".btn3").click(function (){
            var link = $(this);
            var id = link.attr("data-id");
            var cid = link.attr("data-cid");
            if(cid == 0){
                layer.msg('文件已经审核，请不要重复操作');
                return false;
            }
            $.get("{:url('admin/examine/isEae')}?id="+id+"&code=2",function(data){
                console.log(data)
                if(data == 1){
                    layer.msg('审核成功');
                    setTimeout(function(){window.location.reload();},3000);
                }else{
                    layer.msg('审核失败,请检查文件内容');
                    setTimeout(function(){window.location.reload();},3000);
                }
            });
        });
    });
















</script>
</html>